interface Square {
  kind: "square"; // 这个就是具有辨识性的属性
  size: number;
}
interface Rectangele {
  kind: "rectangele";
  height: number;
  width: number;
}
interface Circle {
  kind: "circle";
  radius: number;
}
type Shape = Square | Rectangele | Circle;
function getArea(s: Shape) {
  switch (s.kind) {
    case "square":
      return s.size * s.size;
    case "rectangele":
      return s.height * s.width;
    case "circle":
      return Math.PI * s.radius ** 2;
  }
}